let cookies = "__guid=55846061.4222434736742452000.1587541708879.9495; _ga=GA1.2.603396478.1587541710; __gads=ID=03ffc7fee2a1fcb2:T=1589365691:S=ALNI_MbvO2eGxFNUon8JWEex8lep_Dcn4Q; UM_distinctid=17278b56b7c2b3-004b9262c177f4-376b4502-1fa400-17278b56b7d351; CNZZDATA5475061=cnzz_eid%3D429612072-1591160565-https%253A%252F%252Fwww.so.com%252F%26ntime%3D1591321708; CNZZDATA5068810=cnzz_eid%3D924942627-1593393415-%26ntime%3D1593393415; Hm_lvt_0796772d2f6c0092d893025a82a53c88=1593397801; CNZZDATA1258390419=1025953573-1595899829-https%253A%252F%252Fwww.so.com%252F%7C1595899829; _gid=GA1.2.887814826.1596437127";

function getCookie(name) {
    var reg = new RegExp(name + "={1}.*;?");
    return cookies.match(reg);
}

function getCookie2(str) {
    var tmp, reg = new RegExp("(^| )" + str + "=([^;]*)(;|$)", "gi");
    tmp = reg.exec(cookies);
    if (tmp)
        return (tmp);
    return null;
}

let b = getCookie2('_gid');
// let b = getCookie2('__guid');
console.log(b[0]);